<template>
    <div class="aside">
        <Menu ref="menuList" accordion @on-select="selectMenu" :active-name="selected" :open-names="sys1">
            <menuItemSide :list="list"></menuItemSide>
        </Menu>
    </div>
</template>
<script>
import menuItemSide from "./menuItemSide"
export default {
    name:'menuSide',
    components:{menuItemSide},
    props:{
         list:{
             type:Array,
             default:[],
         },
         selected:{
             type:String,
             default:"",
         },
         sys:{
            type:String,
            default:"",
         }
    },
    data(){
        return {
            sys1:['number']
        }
    },
    watch: {
        sys: function(newValue, oldValue) {
            this.sys1=[newValue]
            // this.sys1.splice(0, this.sys1.length, newValue)//清空 sys1 数组并将新的 newValue 插入到该数组中
            this.$nextTick(() => {
                this.$refs.menuList.updateOpened();//手动更新展开的子目录！:open-names必加！
            })
            this.$forceUpdate()
        }
    },
    methods:{
        selectMenu(path){ 
            this.$emit("menuSelect",path)
        },
    }
}
</script>